package com.headfirst.BehaviorMode.strategy;

import com.headfirst.BehaviorMode.strategy.version3.Duck;
import com.headfirst.BehaviorMode.strategy.version3.FlyRocketPowered;
import com.headfirst.BehaviorMode.strategy.version3.MallardDuck;
import com.headfirst.BehaviorMode.strategy.version3.ModelDuck;
import org.junit.Test;

/**
 * @author sunhongguang
 * @create 2022-01-09-22:32
 */
public class DuckTest3 {

    @Test
    public void test1(){
        Duck mallardDuck = new MallardDuck();
        mallardDuck.display();
        mallardDuck.swim();
        mallardDuck.performQuack();
        mallardDuck.performFly();
        System.out.println("----");

        Duck model = new ModelDuck();
        model.display();
        model.swim();
        model.performQuack();
        model.performFly();
        model.setFlyBehavior(new FlyRocketPowered());
        model.performFly();
    }

}
